package com.azt.provider.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.azt.api.pojo.ProCategoryAttrItem;
import com.azt.api.service.ProCategoryAttrItemService;
import com.azt.provider.mapper.ProCategoryAttrItemMapper;
@Service
@Transactional
public class ProCategoryAttrItemServiceImpl implements ProCategoryAttrItemService{
	@Autowired
	private ProCategoryAttrItemMapper proCategoryAttrItemMapper;
	@Override
	public void saveOrUpdate(ProCategoryAttrItem cateItem) {
		if(cateItem.getId()!=null){
			proCategoryAttrItemMapper.updateByPrimaryKeySelective(cateItem);//更新属性不为空的值
		}else{
			proCategoryAttrItemMapper.insertSelective(cateItem);//保存一个实体，null的属性不会保存，会使用数据库默认值
		}
	}
	@Override
	public void deleteItem(ProCategoryAttrItem oldattr) {
		oldattr.setRemoved(1);
		proCategoryAttrItemMapper.updateByPrimaryKeySelective(oldattr);
	}

}
